package testCase;

import static com.googlecode.charts4j.UrlUtil.normalize;
import static com.googlecode.charts4j.Color.*;
import static org.junit.Assert.assertEquals;

import javax.swing.JFrame;

import com.googlecode.charts4j.RadarChart;
import junit.framework.TestCase;
import org.junit.Test;
import PlayerElement.*;


public class TestAnalysisReport extends TestCase {

	@Test
	public void testChartCorrectGenerated() {
		int sample_score[] = {80,50,50};
		AnalysisReport report = new AnalysisReport("Hanson", sample_score);
		RadarChart chart = report.generateRadarChart();
        String url = chart.toURLString();

        String expectedString = "http://chart.apis.google.com/chart?chco=CC3366&chd=e:ccRyRycc&chls=4,1,0&chm=s,CC3366,0,-1,12,0|s,FFFFFF,0,-1,8,0&chs=400x400&cht=r&chts=000000,20&chtt=Hanson+Performance&chxl=1:|Communication|Understanding|Interaction&chxp=0,0,20,40,60,80,100&chxr=0,0.0,100.0&chxs=0,000000,12,1|1,000000,12,0&chxt=y,x";
        assertEquals("Junit error", normalize(expectedString), normalize(url));

	}
	
	public void testRadarChartJFrame() {
		int sample_score[] = {80,50,50};
		AnalysisReport report = new AnalysisReport("Hanson", sample_score);
		RadarChart chart = report.generateRadarChart();
        
		boolean displayed = report.getRadarChart(chart);
		assertEquals(true, displayed);
	}
}